package com.mydemo.temp;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author jianghaiyang 2021/3/11 11:34
 */
@AllArgsConstructor
@Getter
public enum MerchantTradeOrderStatusEnum {

    FAIL("0", "失败"),

    SUCCESS("1", "成功");

    private String code;

    private String message;

    public static MerchantTradeOrderStatusEnum parse(String code) {
        return Arrays.stream(MerchantTradeOrderStatusEnum.values()).filter(item -> Objects.equals(item.getCode(), code))
            .findAny().orElse(null);
    }
}
